a=int(input())
c=0
k=0
n=0
if 999<a<10000:
    print ('четырёхзначное')
    a1=a//1000
    a2=a//100%10
    a3=a//10%10
    a4=a%10
    minimum=min(a1,a2,a3,a4)
    maximum=max(a1,a2,a3,a4)
    print (maximum,minimum)
    if a1%2==0:
        c= c+1
    else:
         c= c+0
    if a2%2==0:
        c= c+1
    else:
         c= c+0
    if a3%2==0:
        c= c+1
    else:
         c= c+0
    if a4%2==0:
        c= c+1
    else:
         c= c+0
    print(c)

    if a1==1:
        k=k+1
    elif a1==4:
        k=k+1
    elif a1==9:
        k=k+1
    else:
        k=k+0
    if a2==1:
        k=k+1
    elif a2==4:
        k=k+1
    elif a2==9:
        k=k+1
    else:
        k=k+0     
    if a3==1:
        k=k+1
    elif a3==4:
        k=k+1
    elif a3==9:
        k=k+1
    else:
        k=k+0
    if a4==1:
        k=k+1
    elif a4==4:
        k=k+1
    elif a4==9:
        k=k+1
    else:
        k=k+0
    print (k)

    if a1==0:
        n=n+1
    else:
        n=n+0
    if a2==0:
        n=n+1
    else:
        n=n+0
    if a3==0:
        n=n+1
    else:
        n=n+0
    if a4==0:
        n=n+1
    else:
        n=n+0
    print (n)

   
        
